﻿using System.Collections.ObjectModel;
using System.Windows.Controls;

using Game.Toolkit;

namespace Game.Editor.Toolbox
{
    public class BuildingControl2 : UserControl
    {
        readonly WrapPanel _Panel = new WrapPanel();

        public BuildingControl2()
        {
            InitializeComponent();
            Init();
        }

        void InitializeComponent()
        {
            Grid grid = new Grid();
            this.Content = grid;

            ScrollViewer viewer = new ScrollViewer();
            grid.Children.Add(viewer);
            viewer.Content = _Panel;
        }

        void Init()
        {
            Collection<GameObjectGroup> col = StandardToolkit.BuildingObjects;
            foreach (GameObjectGroup v in col)
            {
                BuildingItemControl2 control = new BuildingItemControl2();
                control.GameObjectGroup = v;
                control.Width = 200;
                control.Height = 200;
                this._Panel.Children.Add(control);
            }
        }
    }
}
